package com;


import com.pojo.user;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.*;

import java.io.InputStream;
import java.util.List;

public class mybatisDemo {
    public static void main(String[] args) throws Exception {
        test();
    }
    public static void test() throws Exception {
        String resource = "mybatis-config.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        List<user> use = sqlSession.selectList("test.selectAll");

        System.out.println(use);
        sqlSession.close();
    }
}
